#! /bin/sh
## use susynlv to make synthetic data
susynlv nt=201 dt=0.004 ft=0.0 nxo=1 \
	nxs=100 dxs=.025 fxs=0.0 er=0 ob=0 \
	v00=2.0 dvdz=0 dvdx=0 fpeak=30 smooth=1 \
	ref="1:-1.,.1;7.,.5" \
	ref="1:-1.,.5;7.,.2" \
	ref="2:-1.,.5;7.,.9" |
sushw key=d2 a=.05 >susyn1.out
sufilter <susyn1.out >susyn1.flt

suaddnoise < susyn1.out  sn=8 f=4,8,100,125 amps=0,1,1,0 |
sufilter >susyn1.sn=4.flt

supsimage <susyn1.flt \
	label1="Time [s]" label2="Trace #" grid1=dot d1num=.1 d2num=10 \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
	title="Signal"  perc=99.5 >susyn1.flt.ps 

supsimage <susyn1.sn=4.flt \
	label1="Time [s]" label2="Trace #" grid1=dot d1num=.1 d2num=10 \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
	title="Data"  perc=99.5 >susyn1.sn=4.flt.ps

sufxdecon <susyn1.sn=4.flt >susyn1.sn=4.fx ntrw=100  
supsimage <susyn1.sn=4.fx  >susyn1.sn=4.flt.sufx.ps \
        label1="Time [s]" label2="Trace #" grid1=dot d1num=.1 d2num=10 \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
	title="Fxdcn over Data"  perc=99.5

sufxdecon <susyn1.flt >susyn1.flt.fx ntrw=100
supsimage <susyn1.flt.fx  >susyn1.flt.sufx.ps \
        label1="Time [s]" label2="Trace #" grid1=dot d1num=.1 d2num=10 \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
	title="Fxdcn over Signal"  perc=99.5  

merge4 susyn1.flt.ps susyn1.flt.sufx.ps susyn1.sn=4.flt.ps susyn1.sn=4.flt.sufx.ps > m4.ps 

suop2 susyn1.flt susyn1.flt.fx op=diff |
supsimage >susyn1.sn.diff.ps \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
        label1="Time [s]" label2="Trace #" grid1=dot d1num=.1 d2num=10 \
	title="Diff: signal - fx(signal)"  perc=99.5  
suop2 susyn1.flt susyn1.sn=4.fx op=diff |
supsimage >susyn1.fx.diff.ps \
        label1="Time [s]" label2="Trace #" grid1=dot d1num=.1 d2num=10 \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
	title="Diff: signal - fx(data)"  perc=99.5

merge4 susyn1.flt.ps susyn1.sn.diff.ps susyn1.sn=4.flt.ps susyn1.fx.diff.ps >m4.diff.ps

echo "You may view the files:  m4.ps  and m4.diff.ps  with your PostScript Previewer."

exit 0

